package com.xiaolun.single;

//枚举类型
public class Singleton8{
    public static void main(String[] args) {
        SingletonEnum instance = SingletonEnum.INSTANCE;
        SingletonEnum instance2 = SingletonEnum.INSTANCE;
        System.out.println(instance.hashCode());
        System.out.println(instance2.hashCode());
    }

}

enum SingletonEnum{
    INSTANCE; //属性
    //定义方法
    public void sayok(){
        System.out.println("ok");
    }
}